#!/usr/bin/env node

const Koa = require('koa');

const app = new Koa();

app.use((ctx,next)=>{ //M-logger
  console.log(`${ctx.method} ${ctx.path}`);
  next();
});

app.use((ctx,next)=>{  //M-ms
  const start = Date.now();
  next();
  const end = Date.now();
  console.log(`cost:${end-start}ms`);
})
//用来下载中间件
app.use((ctx,next)=>{  //M-hello
  ctx.body = 'hello world';
});
app.listen(8080);
